<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <title>审核</title>
    <link href="../../resource/css/bootstrap.min.css?v=3.3.5" rel="stylesheet"
          th:href="@{/resource/css/bootstrap.min.css?v=3.3.5}"/>
    <link href="../../resource/hotui/css/font-awesome.min.css" th:href="@{/resource/hotui/css/font-awesome.min.css}"
          rel="stylesheet">
    <!-- Morris -->
    <link href="../../resource/hotui/css/plugins/morris/morris-0.4.3.min.css"
          th:href="@{/resource/hotui/css/plugins/morris/morris-0.4.3.min.css}" rel="stylesheet">
    <link href="../../resource/hotui/css/style.min-1.0.8.css" th:href="@{/resource/hotui/css/style.min-1.0.8.css}"
          rel="stylesheet">
    <link href="../../resource/hotui/css/hotui.style.override.css"
          th:href="@{/resource/hotui/css/hotui.style.override.css}" rel="stylesheet"/>
    <style>
        body, html {
            min-width: auto;
        }

        .col-inline-block {
            display: inline-block !important;
        }

        .col-inline-block input {
            width: 300px;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="tabs-container">
                <div class="tab-content">
                    <div class="tab-pane active" id="tab-1">
                        <!--表单-->
                        <div class="panel-body">
                            <form class="form-horizontal m-t" id="mtForm">

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">状态 <span class="font-red">*</span>：</label>
                                    <div class="col-sm-4 col-inline-block">
                                        <select class="form-control" id="sltAudit">
                                            <option value="1">审核通过</option>
                                            <option value="2">审核拒绝</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label" for="reason">审核理由 <span
                                            class="font-red">*</span>：</label>
                                    <div class="col-sm-4 col-inline-block">
                                        <input class="form-control input-sm" id="reason"
                                               name="reason"
                                               placeholder="审核理由" type="text"/>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <!--END表单-->

                        <!--按钮-->
                        <div class="panel-body">
                            <div class="col-sm-6" style="text-align: center">
                                <button class="btn btn-primary" onclick="handler.submit()"
                                        style="width: 200px" type="button">提交审核
                                </button>
                            </div>
                        </div>
                        <!--按钮-->
                    </div>


                </div>
            </div>
        </div>
    </div>
</div>

<script src="../../resource/js/jquery.min2.2.4.js?v=2.1.4" th:src="@{/resource/js/jquery.min2.2.4.js?v=2.1.4}"></script>
<script src="../../resource/js/bootstrap.min.js?v=3.3.5" th:src="@{/resource/js/bootstrap.min.js?v=3.3.5}"></script>
<script src="../../resource/js/content.min.js?v=1.0.0" th:src="@{/resource/js/content.min.js?v=1.0.0}"></script>
<script src="../../resource/lib/moment.min.js" th:src="@{/resource/lib/moment.min.js}"></script>

<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-utils.js"
        th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-utils.js?v=1.0.0}"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-init.js"
        th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-init.js?v=1.0.0}"></script>

<script th:inline="javascript">
    const merchantId = /*[[${merchantId}]]*/ 0;
    const SAVE_API =/*[[@{/merchant/audit}]]*/ "";
</script>
<script>
    var index = parent.layer.getFrameIndex(window.name);
    let handler = {
        submit() {
            let requestData = {
                id: merchantId,
                status: $("#sltAudit").val(),
                reason: $("#reason").val()
            }
            if (requestData.status === 2 && requestData.reason.length === 0) {
                hot.tip.msg("请输入审核理由");
                return;
            }
            hot.ajax(SAVE_API, requestData, function (ret) {
                if (ret.success) {
                    hot.tip.success("操作成功");
                    setTimeout(() => {
                        parent.location.reload();
                        parent.layer.close(index);
                    }, 1500);
                } else {
                    hot.tip.msg(ret.resultMsg);
                }
            }, function () {
                hot.tip.msg("操作失败");
            }, "post");
        },
    };

    $(function () {
    });
</script>


</body>
</html>